<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>C:\WorkingCopy\ColorTest\GetEnv.java.html</title>
<meta name="Generator" content="Vim/7.2">
<meta http-equiv="content-type" content="text/html; charset=Big5">
<style type="text/css">
<!--
pre { font-family: monospace; color: #000000; background-color: #ffffff; }
body { font-family: monospace; color: #000000; background-color: #ffffff; }
-->
</style>
</head>
<body>
<pre>
import java.util.Map;
import java.util.TreeSet;

public class GetEnv {
  /**
   * let's test generics
   * @param args the command line arguments
   */
  public static void main(String[] args) {
    // get a map of environment variables
    Map&lt;String, String&gt; env = System.getenv();
    // build a sorted set out of the keys and iterate
    for(String k: new TreeSet&lt;String&gt;(env.keySet())) {
      System.out.printf(&quot;%s = %s\n&quot;, k, env.get(k));
    }
  }
}
</pre>
</body>
</html>
